import 'dart:collection';

class SelfDetailModel {
  String? nickname;
  String? age;
  String? imageUrl;
  String? sex;
  String? height;
  String? weight;
  String? birthday;
  String? provinceName;
  String? provinceCode;
  String? cityName;
  String? cityCode;
  String? areaName;
  List<GoodPosition>? goodPosition;

  SelfDetailModel(
      {this.nickname,
      this.age,
      this.imageUrl,
      this.sex,
      this.height,
      this.weight,
      this.birthday,
      this.provinceName,
      this.provinceCode,
      this.cityName,
      this.cityCode,
      this.areaName,
      this.goodPosition});

  SelfDetailModel.fromJson(Map<String, dynamic> json) {
    nickname = json['nickname'];
    age = json['age'];
    imageUrl = json['imageUrl'];
    sex = json['sex'];
    height = json['height'];
    weight = json['weight'];
    birthday = json['birthday'];
    provinceName = json['provinceName'];
    provinceCode = json['provinceCode'];
    cityName = json['cityName'];
    cityCode = json['cityCode'];
    areaName = json['areaName'];
    if (json['goodPosition'] != null) {
      goodPosition = <GoodPosition>[];
      json['goodPosition'].forEach((v) {
        if (v != null) {
          goodPosition!.add(GoodPosition.fromJson(v));
        }
      });
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = HashMap();
    data['nickname'] = nickname;
    data['age'] = age;
    data['imageUrl'] = imageUrl;
    data['sex'] = sex;
    data['height'] = height;
    data['weight'] = weight;
    data['birthday'] = birthday;
    data['provinceName'] = provinceName;
    data['provinceCode'] = provinceCode;
    data['cityName'] = cityName;
    data['cityCode'] = cityCode;
    data['areaName'] = areaName;
    if (goodPosition != null) {
      data['goodPosition'] = goodPosition!.map((v) => v.toJson()).toList();
    }
    return data;
  }
}

class GoodPosition {
  String? positionSortCode;
  String? positionSortDescription;
  String? subdivisionPosition;
  String? subdivisionPositionCode;

  GoodPosition(
      {this.positionSortCode,
      this.positionSortDescription,
      this.subdivisionPosition,
      this.subdivisionPositionCode});

  GoodPosition.fromJson(Map<String, dynamic> json) {
    positionSortCode = json['positionSortCode'];
    positionSortDescription = json['positionSortDescription'];
    subdivisionPosition = json['subdivisionPosition'];
    subdivisionPositionCode = json['subdivisionPositionCode'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = HashMap();
    data['positionSortCode'] = positionSortCode;
    data['positionSortDescription'] = positionSortDescription;
    data['subdivisionPosition'] = subdivisionPosition;
    data['subdivisionPositionCode'] = subdivisionPositionCode;
    return data;
  }
}